package demo2;

import javax.print.attribute.standard.MediaSize;

//投资基金代码
public class Main {
    public static void main(String[] args) {
        Fund fundA = new Fund();
        fundA.BuyFund(); //买基金
        fundA.SellFund();   //赎回基金
    }
}

class Stock1{//股票一

    //卖股票
    public void Sell(){
        System.out.println("出售股票一");
    }
    //买股票
    public void Buy(){
        System.out.println("买入股票一");
    }
}
class Stock2{//股票二

    //卖股票
    public void Sell(){
        System.out.println("出售股票二");
    }
    //买股票
    public void Buy(){
        System.out.println("买入股票二");
    }
}
class Stock3{//股票三

    //卖股票
    public void Sell(){
        System.out.println("出售股票三");
    }
    //买股票
    public void Buy(){
        System.out.println("买入股票三");
    }
}
class Stock4{//股票四

    //卖股票
    public void Sell(){
        System.out.println("出售股票四");
    }
    //买股票
    public void Buy(){
        System.out.println("买入股票四");
    }
}

class NationalDebt{//国债

    //卖国债
    public void Sell(){
        System.out.println("出售国债");
    }
    //买国债
    public void Buy(){
        System.out.println("买入国债");
    }
}
class Realty{
    //房地产类
    public void Sell(){
        System.out.println("出售房子");
    }
    public void Buy(){
        System.out.println("买房子");
    }
}
//基金类
class Fund{
    Stock1 stock1;
    Stock2 stock2;
    Stock3 stock3;
    Stock4 stock4;
    NationalDebt nationalDebt;
    Realty realty;

    public Fund(){
        stock1 = new Stock1();
        stock2 = new Stock2();
        stock3 = new Stock3();
        stock4 = new Stock4();
        nationalDebt = new NationalDebt();
        realty = new Realty();
    }

    public void BuyFund(){
        System.out.println("======Buy基金=======");
        stock1.Buy();
        stock2.Buy();
        stock3.Buy();
        stock4.Buy();
        nationalDebt.Buy();
        realty.Buy();
        System.out.println("======Buy基金=======\n");
    }
    public void SellFund(){
        System.out.println("======Sell基金=======");
        stock1.Sell();
        stock2.Sell();
        stock3.Sell();
        stock4.Sell();
        nationalDebt.Sell();
        realty.Sell();
        System.out.println("======Sell基金=======\n");
    }
}
